<!DOCTYPE html>
<html>
    
    <head>
       <meta charset="UTF-8">
        {include="style"}
		{include="edit"}
		<style>
		.layui-form-select.layui-form-selected {
			z-index: 9999;
		}
		</style>
		
    </head>
    
    <body>
	 <div class="x-nav">
            <span class="layui-breadcrumb">
              <a><cite>首页</cite></a>
              <a><cite>评论管理</cite></a>
             
			  <a><cite>查看评论</cite></a>
            </span>
            <a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right"  href="javascript:location.replace(location.href);" title="刷新"><i class="iconfont" style="line-height:30px">&#xe6aa;</i></a>
        </div>
        <div class="x-body">
            <form class="layui-form layui-form-pane" >
			<input type="hidden" name="go" value="1" />
			<input type="hidden" name="id" value="{$data['id']}" />
			
			<div class="layui-tab">
			  <ul class="layui-tab-title">
				<li class="layui-this">基本信息</li>
				<li>扩展信息</li>
				
			  </ul>
			  <div class="layui-tab-content">
				<div class="layui-tab-item layui-show">
				 <div class="layui-form-item">
                    <label for="userid" class="layui-form-label">
                        <span class="x-red"></span>用户ID
                    </label>
                    <div class="layui-input-inline">
                        <input type="number" id="userid" value="{$data['userid']}"  name="userid" 
                        autocomplete="off" class="layui-input">
                    </div>
                </div>
				<div class="layui-form-item">
                    <label for="tid" class="layui-form-label">
                        <span class="x-red"></span>评论栏目
                    </label>
                    <div class="layui-input-inline">
						<select name="tid" lay-search="" id="tid" >
						<option value="0">选择栏目</option>
					   {foreach $classtypes as $v}
					   <option {if($data['tid']==$v['id'])} selected="selected" {/if}  value="{$v['id']}">{fun str_repeat('--', $v['level'])}{$v['classname']}</option>
					   {/foreach}
					   </select>
                    </div>
                </div>
				<div class="layui-form-item">
                    <label for="aid" class="layui-form-label">
                        <span class="x-red"></span>文章ID
                    </label>
                    <div class="layui-input-inline">
                        <input type="number" id="aid" value="{$data['aid']}"   name="aid" 
                        autocomplete="off" class="layui-input">
                    </div>
                </div>
				<div class="layui-form-item">
                    <label for="zid" class="layui-form-label">
                        <span class="x-red"></span>主回复ID
                    </label>
                    <div class="layui-input-inline">
                        <input type="number" id="zid" value="{$data['zid']}" name="zid" 
                        autocomplete="off" class="layui-input">
                    </div>
					<div class="layui-form-mid layui-word-aux">
						<span class="x-red"></span>同属于一个评论的ID，如果没有评论中的评论，则为0
					</div>
                </div>
				<div class="layui-form-item">
                    <label for="pid" class="layui-form-label">
                        <span class="x-red"></span>回复帖子ID
                    </label>
                    <div class="layui-input-inline">
                        <input type="number" id="pid" value="{$data['pid']}" name="pid" 
                        autocomplete="off" class="layui-input">
                    </div>
					<div class="layui-form-mid layui-word-aux">
					  <span class="x-red"></span>回复帖子ID
				    </div>
                </div>
             
				
				
				 <div class="layui-form-item layui-form-text">
                    <label for="body" class="layui-form-label">
                        <span class="x-red"></span>评论内容
                    </label>
                    <div class="layui-input-block" style="clear:both;" >
					{include="content"}
                    </div>
                </div>
				
				
				 <div class="layui-form-item layui-form-text">
                    <label for="reply" class="layui-form-label">
                        <span class="x-red"></span>管理员回复
                    </label>
                    <div class="layui-input-block" style="clear:both;" >
					<textarea  name="reply" class="layui-textarea">{$data['reply']}</textarea>
                    </div>
                </div>
				<div class="layui-form-item" pane>
                    <label for="ismsg" class="layui-form-label">
                        <span class="x-red"></span>是否提醒回复
                    </label>
                    <div class="layui-input-inline">
                        <input type="radio" name="ismsg" value="1" title="提醒" >
						<input type="radio" name="ismsg" value="0" title="不提醒" checked>
                    </div>
					
					
                </div>
				<div class="layui-form-item">
                    <label for="likes" class="layui-form-label">
                        <span class="x-red"></span>喜欢/点赞
                    </label>
                    <div class="layui-input-inline">
                        <input type="number" id="likes" value="{$data['likes']}" name="likes" 
                        autocomplete="off" class="layui-input">
                    </div>
					 
					
                </div>
				<div class="layui-form-item" pane>
                    <label for="isread" class="layui-form-label">
                        <span class="x-red"></span>是否已读
                    </label>
                    <div class="layui-input-inline">
                        <input type="radio" name="isread" value="0" title="未读" {if($data['isread']==0)}checked{/if}>
						<input type="radio" name="isread" value="1" title="已读" {if($data['isread']==1)}checked{/if}>
                    </div>
					
					
                </div>
				<div class="layui-form-item" pane>
                    <label for="isshow" class="layui-form-label">
                        <span class="x-red"></span>是否删除
                    </label>
                    <div class="layui-input-inline">
                        <input type="radio" name="isshow" value="0" title="已删除" {if($data['isshow']==0)}checked{/if}>
						<input type="radio" name="isshow" value="1" title="未删除" {if($data['isshow']==1)}checked{/if}>
                    </div>
					 <div class="layui-form-mid layui-word-aux">
					 只能管理员删除评论，用户只能软删除评论
				     </div>
					
                </div>
				
				 <div class="layui-form-item">
                    <label for="addtime" class="layui-form-label">
                        <span class="x-red"></span>更新时间
                    </label>
                    <div class="layui-input-inline">
                      <input class="layui-input" value="{if($data)}{fun date('Y-m-d H:i:s',$data['addtime'])}{else}{fun date('Y-m-d H:i:s')}{/if}" name="addtime" placeholder="文件日期" id="LAY_demorange_s">
                    </div>
                   
                </div>
				{if($webconf['isrelative']==1)}
				<span id="ext_fields"></span>
				{/if}

				</div>
				<div class="layui-tab-item">
				{if($webconf['isrelative']==0)}
				<span id="ext_fields"></span>
				{/if}
				
				</div>
			  </div>
			</div>
               
                <div class="layui-form-item" style="text-align:center;">
                   
                     <button  class="layui-btn" lay-filter="save" lay-submit="">
                        保存
                    </button>
                </div>
            </form>
        </div>
		<br/>
		<br/>
		<br/>
		<br/>
		<br/>
		<br/>
		<br/>
		<br/>
		<br/>
      
        <script>
		{include="fields"}
            layui.use(['laydate','form','layer','upload'], function(){
                $ = layui.jquery;
              var form = layui.form
              ,layer = layui.layer;
			  laydate = layui.laydate;
			  var upload = layui.upload;
			   laydate.render({
				elem: '#LAY_demorange_s', //指定元素
				type:'datetime'
			  });
              //图片上传接口
              upload.render({
			    elem: '#LAY_demo_upload',
                url: '{__APP_URL__}/Common/uploads' //上传接口
                ,done: function(res){ //上传成功后的回调
                   // console.log(res);
					
					if(res.code==0){
						 $('#fileimg').attr('src',res.url);
						 $('#litpic').val(res.url);
					}else{
						 layer.alert(res.error, {icon: 5});
					}
                 
                }
              });
			  
			    //监听提交
              form.on('submit(save)', function(data){
                //console.log(data);
                //发异步，把数据提交给php
				$.post("{__APP_URL__}/Comment/editcomment.html",data.field,function(r){
					var r = JSON.parse(r);
					if(r.code==0){
						 layer.msg(r.msg, {icon: 6,time: 2000},function () {
							// 获得frame索引
							
							{if($webconf['admintpl']=='tpl')}
							window.location.href="{fun U('Comment/commentlist')}";
							{else}
							parent.location.reload();
							{/if}
						});
					}else{
						layer.alert(r.msg, {icon: 5});
					}
				});
				
               
                return false;
              });
            get_fields(0,{$data['id']});
			
			
           
              
              
            });
        </script>
      
    </body>

</html>